import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import dts from 'vite-plugin-dts'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), dts({
    outDir: 'dist/types'
  })],
  build: {
    lib: {
      entry: path.resolve(__dirname, 'src/components/index.ts'),
      name: 'HiDesignVue',
      fileName: (format) => `hi-design-vue.${format}.js`
    },
    rollupOptions: {
      external: ['vue'],
      output: {
        globals: {
          vue: 'Vue'
        }
      }
    }
  },
  resolve: {
        alias: {
          '@style': path.resolve(__dirname, './src/style'),
          '@component': path.resolve(__dirname, './src/components')
        }
  },
  // 添加开发服务器配置
  server: {
    port: 3000,
    open: true
  }
})
